home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 045a / tpapi1.zip / SETLOGIN.PAS < prev   
Pascal/Delphi Source File  |  1991-12-04  |  3KB  |  107 lines

  1. {***************************************************************************}
  2. {** Program : SETLOGIN.PAS                                                **}
  3. {***************************************************************************}
  4. {** Version : 1.0             ** Started : 19/12/90  ** Ended : 19/12/90  **}
  5. {***************************************************************************}
  6. {******************************** Description ******************************}
  7. {***************************************************************************}
  8. {** SETLOGIN allows the SUPERVISOR or a console operator to enable or     **}
  9. {** disable login on a file server.  The user must be sitting on the file **}
  10. {** server where login is to be enabled or disabled.                      **}
  11. {**                                                                       **}
  12. {**                                                                       **}
  13. {***************************************************************************}
  14. {******************************** Information ******************************}
  15. {***************************************************************************}
  16. {** To enable login use  : SETLOGIN TRUE                                  **}
  17. {** To disable login     : SETLOGIN FALSE                                 **}
  18. {**                                                                       **}
  19. {** The user will be informed if the operation was sucessful or not.      **}
  20. {**                                                                       **}
  21. {***************************************************************************}
  22.  
  23. program SETLOGIN;
  24.  
  25. uses
  26.  
  27.   crt, nwvar, nwerror, nwfsserv;
  28.  
  29. const
  30.  
  31.   ProgramName = 'SETLOGIN.EXE';
  32.   Version     = '1.0';
  33.   Description = 'Allows SUPERVISOR or CONSOLE operator to enable / disable login';
  34.  
  35. var
  36.  
  37.   FileServer  : ^FileServerOBJ;
  38.   CommandLine : string;
  39.   OK          : boolean;
  40.  
  41. {******}
  42.  
  43. function GetCommandLine : boolean;
  44.  
  45. begin
  46.  
  47.   OK := true;
  48.   if (paramcount < 1) or (FileServer^.CheckConsolePrivileges <> Successful) then
  49.     OK := false
  50.   else
  51.     begin
  52.  
  53.       CommandLine := FileServer^.UppercaseNW (paramstr (1));
  54.       if (CommandLine <> 'TRUE') and (CommandLine <> 'FALSE') then
  55.         OK := false;
  56.  
  57.     end;
  58.  
  59.   if not OK then
  60.     begin
  61.  
  62.       clrscr;
  63.       textcolor (white);
  64.       writeln;
  65.       writeln ('Program : ',ProgramName);
  66.       writeln ('Version : ',Version);
  67.       writeln ('Description : ',Description);
  68.       writeln;
  69.       writeln;
  70.       textcolor (green);
  71.       writeln ('USAGE : ');
  72.       writeln;
  73.       textcolor (yellow);
  74.       writeln ('SETLOGIN [TRUE] [FALSE]');
  75.       writeln;
  76.       textcolor (white);
  77.       writeln ('[TRUE]  allow users to login');
  78.       writeln ('[FALSE] do not allow users to login');
  79.       writeln;
  80.       writeln ('You must be SUPERVISOR or a CONSOLE operator!');
  81.       halt (1);
  82.  
  83.     end;
  84.  
  85.   if CommandLine = 'TRUE' then
  86.     GetCommandLine := true
  87.   else
  88.     GetCommandLine := false;
  89.  
  90. end; {procedure GetCommandLine}
  91.  
  92. {******}
  93.  
  94. begin
  95.  
  96.   new (FileServer, Init);
  97.  
  98.   if GetCommandLine then
  99.     writeln ('Enabling login : ', FileServer^.EnableFileServerLogin = 0)
  100.   else
  101.     writeln ('Disabling login : ', FileServer^.DisableFileServerLogin = 0);
  102.  
  103.   FileServer^.Done;
  104.   dispose (FileServer);
  105.  
  106. end.
  107.